﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Dobbelsteen
{
    public partial class DiceForm : Form
    {
        //try with array, somehow
        PictureBox[] pBoxes = new PictureBox[6];
        int randomInt;
        public DiceForm()
        {
            InitializeComponent();
           pBoxes[0] = number1PictureBox;
           pBoxes[1] = number2PictureBox;
           pBoxes[2] = number3PictureBox;
           pBoxes[3] = number4PictureBox;
           pBoxes[4] = number5PictureBox;
           pBoxes[5] = number6PictureBox;
           
        }

        private void RollButton_Click(object sender, EventArgs e)
        {
            MakeVisibleFalse();
            RandomPic();
            if (randomInt == 1)
                number1PictureBox.Visible = true;
            if (randomInt == 2)
                number2PictureBox.Visible = true;
            if (randomInt == 3)
                number3PictureBox.Visible = true;
            if (randomInt == 4)
                number4PictureBox.Visible = true;
            if (randomInt == 5)
                number5PictureBox.Visible = true;
            if (randomInt == 6)      
                number6PictureBox.Visible = true;
            //Items.Clear();
        }
        public void RandomPic()
        {
            Random rand = new Random();
            for (int i = 0; i <= 6; i++)
            {
                randomInt = rand.Next(1, 7);
            }
            
        }
        public void MakeVisibleFalse()
        {
            number1PictureBox.Visible = false;
            number2PictureBox.Visible = false;
            number3PictureBox.Visible = false;
            number4PictureBox.Visible = false;
            number5PictureBox.Visible = false;
            number6PictureBox.Visible = false;
        }
    }
}
